package com.spring.annotation_demo;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {

	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
		String[] beanDefinitionNames = context.getBeanDefinitionNames();
		for (String beanDefinitionName : beanDefinitionNames) {
			System.out.println(beanDefinitionName);
		}
		//MyService02 myService02 = (MyService02) context.getBean("myService02");
		//myService02.say();

		//FactoryMethodComponent01 测试
		//TestBean testBean = (TestBean) context.getBean("publicInstance");
		//String s = testBean.toString();
		//System.out.println(s);

		//FactoryMethodComponent02  测试
		TestBean bean = (TestBean) context.getBean("protectedInstance");
		String s = bean.toString();
		System.out.println("s bean:"+s);

	}
}
